package com.cisetech.service.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cisetech.mapper.bobocai.TitleMapper;
import com.cisetech.service.IndexServic;
import com.cisetech.vo.bobocai.TitleVo;

@Service
public class IndexServicImpl implements IndexServic {
	protected final static Logger log = LoggerFactory.getLogger(IndexServicImpl.class);
	@Autowired
	TitleMapper titleMapper;
	@Override
	public String indexHead(TitleVo titleVo) {
		try {
			titleVo.setPrId("0");
			titleVo.setLogoSite("logo.jpg");
			List<TitleVo> list = titleMapper.findTitleHeadByPrId(titleVo);
			if(list!=null && list.size()>0){
				titleMapper.updataTitle(titleVo);
				return "1";
			}else{
				titleMapper.saveTitle(titleVo);
				return "0";
			}
		} catch (Exception e) {
			log.debug(e.getMessage());
			return "2";
		}
	}
	
}
